package org.apache.harmony.awt.datatransfer;

import com.sun.mail.smtp.SMTPMessage;
import org.apache.harmony.awt.internal.nls.Messages;
import org.apache.harmony.misc.SystemUtils;

public abstract class DTK {
    protected final DataTransferThread dataTransferThread = new DataTransferThread(this);
    private NativeClipboard nativeClipboard = null;
    private NativeClipboard nativeSelection = null;

    public abstract void initDragAndDrop();

    public abstract void runEventLoop();

    protected DTK() {
        this.dataTransferThread.start();
    }

    /* JADX WARNING: inconsistent code. */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public static org.apache.harmony.awt.datatransfer.DTK getDTK() {
        /*
        r2 = org.apache.harmony.awt.ContextStorage.getContextLock();
        monitor-enter(r2);
        r1 = org.apache.harmony.awt.ContextStorage.shutdownPending();	 Catch:{ all -> 0x001d }
        if (r1 == 0) goto L_0x000e;
    L_0x000b:
        monitor-exit(r2);	 Catch:{ all -> 0x001d }
        r0 = 0;
    L_0x000d:
        return r0;
    L_0x000e:
        r0 = org.apache.harmony.awt.ContextStorage.getDTK();	 Catch:{ all -> 0x001d }
        if (r0 != 0) goto L_0x001b;
    L_0x0014:
        r0 = createDTK();	 Catch:{ all -> 0x001d }
        org.apache.harmony.awt.ContextStorage.setDTK(r0);	 Catch:{ all -> 0x001d }
    L_0x001b:
        monitor-exit(r2);	 Catch:{ all -> 0x001d }
        goto L_0x000d;
    L_0x001d:
        r1 = move-exception;
        monitor-exit(r2);	 Catch:{ all -> 0x001d }
        throw r1;
        */
        throw new UnsupportedOperationException("Method not decompiled: org.apache.harmony.awt.datatransfer.DTK.getDTK():org.apache.harmony.awt.datatransfer.DTK");
    }

    private static DTK createDTK() {
        String name;
        switch (SystemUtils.getOS()) {
            case SMTPMessage.RETURN_FULL /*1*/:
                name = "org.apache.harmony.awt.datatransfer.windows.WinDTK";
                break;
            case SMTPMessage.RETURN_HDRS /*2*/:
                name = "org.apache.harmony.awt.datatransfer.linux.LinuxDTK";
                break;
            default:
                throw new RuntimeException(Messages.getString("awt.4E"));
        }
        try {
            return (DTK) Class.forName(name).newInstance();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public String getDefaultCharset() {
        return "unicode";
    }
}
